<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>客户端A</title>
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/socket.js"></script>
    <script type="text/javascript">
        var socket;
        function conn() {
            if(!socket){
                socket = createScoket("123")
            }
        }
        function sendMsg() {
            socket.send("给客户端B发送的消息:"+$("#content").val());
        }
    </script>

</head>
<body>
<input type="button" value="连接" onclick="conn()">
<input type="text" id="content">
<input type="button" value="发送消息"  onclick="sendMsg()">
</body>
</html>